import React, { Component, useCallback, useState, useEffect } from 'react';

export default function Example() {
  const [text, setText] = useState(null);
  const loaded = () => {
    clearTimeout(timer);
    setText('loading');
    let timer = setTimeout(() => {
      let text = <button onClick={loaded}>loaded+</button>;
      setText(text);
    }, 3000);
  };
  useEffect(() => {
    setText('loading');
    setTimeout(() => {
      let text = <button onClick={loaded}>loaded+</button>;
      setText(text);
    }, 3000);
  }, []);
  return <div>{text}</div>;
}
